package com.yueka.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yueka.pojo.entity.statement.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface StatementMapper extends BaseMapper<Statement> {
    @Select("select (select count(*) from student) as studentCount, (select count(*) from teacher) as teacherCount, sum(total_lessons) as totalLessonsSum, sum(finished_lessons) as finishedLessonsSum, (select count(*) from instrument_category) as instrumentCategoryCount from course")
    Statement getStatement();

    @Select("select source, count(*) as count from student group by source")
    List<StudentSourceCount> getStudentSourceCounts();

    @Select("select status, count(*) as count from student group by status")
    List<StudentStatusCount> getStudentStatusCounts();

    @Select("select ic_Id, ic_name, sum(total_lessons) as sum from course c, instrument_category ic where c.ic_Id = ic.id group by ic_Id;")
    List<CourseInstrumentCategorySum> getCourseInstrumentCategorySums();

    List<Trend> getStudentTrend(@Param("start") String start, @Param("end") String end);

    List<Trend> getRourseRecordTrend(@Param("start") String start, @Param("end") String end);
}
